package game;

/**
 *	@(#)GameObject.java
 *
 *	The <code>GameObject</code> class is the super class for all
 *	elements in the game.
 *
 *	@author Grzegorz Kobiela
 *	@version 1.0 2007/9/11
 */
public abstract class GameObject
extends java.util.Observable
{
	/** The state of activity. */
	protected boolean active = false;

	/**
	 *	Activates the game object.
	 */
	public void activate() {
		update(active = true);
	}

	/**
	 *	Deactivates the game object.
	 */
	public void deactivate() {
		update(active = false);
	}

	/**
	 *	Returns true if the game object is active.
	 *	@return true if the game object is active
	 */
	public boolean isActive() {
		return active;
	}

	/**
	 *	Updates all observers with the given argument.
	 *	@param arg the argument
	 */
	public void update(Object arg) {
		setChanged();
		notifyObservers(arg);
	}

	/**
	 *	Returns the string representation of this object.
	 *	@return the string representation
	 */
	@Override
	public String toString() {
		return getClass().getSimpleName();
	}
}